/*
 * Copyright 2004 original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jbfilter.test.beans;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.jbfilter.test.beans.util.ToStringUtils;

/**
 * A recording of a composer's work.
 * @author Marcus Adrian
 *
 */
public class Recording implements Cloneable {
	private Long id;
	private Work work;
	/**
	 * Year of recording.
	 */
	private int year;
	/**
	 * Month of recording. 1-based : 2 == February.
	 */
	private int month;
	private String recordingLocation;
	/**
	 * Cast, roles etc.
	 */
	private String description;
	
	@Override
	protected Recording clone() {
		Recording clone = new Recording();
		clone.setId(id);
		clone.setWork(work == null ? null : work.clone());
		clone.setYear(year);
		clone.setMonth(month);
		clone.setRecordingLocation(recordingLocation);
		clone.setDescription(description);
		return clone;
	}
	
	@Override
	public String toString() {
		ToStringBuilder builder = ToStringUtils.getToStringBuilderMultipleLines(this);
		builder.append("id", id);
	    if (work == null) {
			builder.append("work", "null");
		} else {
			builder.append("work.title", work.getTitle());
		}
	    builder.append("year", year);
	    builder.append("month", month);
	    
	    builder.append("recordingLocation", recordingLocation);
	    builder.append("description", description);
		return builder.toString();
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Work getWork() {
		return work;
	}
	public void setWork(Work work) {
		this.work = work;
	}
	public int getYear() {
		return year;
	}
	public void setYear(int year) {
		this.year = year;
	}
	public int getMonth() {
		return month;
	}
	public void setMonth(int month) {
		this.month = month;
	}
	public String getRecordingLocation() {
		return recordingLocation;
	}
	public void setRecordingLocation(String recordingLocation) {
		this.recordingLocation = recordingLocation;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
}
